@extends('public.main')
@section('title', '睡前小故事|❤大千世界，我们并不是缺少一个说话的朋友，而是渴望一个理解自己读懂自己的伙伴。')

@section('css')
    <meta name="keywords" content="❤大千世界，我们并不是缺少一个说话的朋友，而是渴望一个理解自己读懂自己的伙伴。"/>
    <link rel="stylesheet" type="text/css" href="{{ asset('/static/css/index.css') }}">
@endsection

@section('content')
    <div class="col-md-12 col-xs-12">
        <div class="col-md-12 col-xs-12" style="margin:0px;padding:0px;">
            <div class="col-md-12 col-xs-12 content_left" style="margin:0px;padding:0px;">
                @include('mobile.public.content', ['datas' => $articles, 'printType' => 3])
                <div class="col-sm-12 col-xs-12" style="margin: 0px;padding: 0px;">
                    <script type="text/javascript">
                        document.write('<a style="display:none!important" id="tanx-a-mm_56967596_36728993_131770358"></a>');
                        tanx_s = document.createElement("script");
                        tanx_s.type = "text/javascript";
                        tanx_s.charset = "gbk";
                        tanx_s.id = "tanx-s-mm_56967596_36728993_131770358";
                        tanx_s.async = true;
                        tanx_s.src = "http://p.tanx.com/ex?i=mm_56967596_36728993_131770358";
                        tanx_h = document.getElementsByTagName("head")[0];
                        if(tanx_h)tanx_h.insertBefore(tanx_s,tanx_h.firstChild);
                    </script>
                </div>
            </div>

            <div class="col-md-12 col-xs-12" style="text-align: center">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        @if( $currentPage==1 )
                            <li class="disabled">
                                <a aria-label="Previous">
                                    <span aria-hidden="true">上一页</span>
                                </a>
                            </li>
                        @else
                            <li>
                                <a href="/story?page={{ $currentPage-1 }}" aria-label="Previous">
                                    <span aria-hidden="true">上一页</span>
                                </a>
                            </li>
                        @endif

                        <!-- 判断分页数是否到达5 -->
                            @if( $page_num <= 5 )
                                @for($i=1;$i<=$page_num;$i++)
                                    @if( $currentPage==$i )
                                        <li class="active"><a href="/story?page={{ $i }}">{{ $i }}</a></li>
                                    @else
                                        <li><a href="/story?page={{ $i }}">{{ $i }}</a></li>
                                    @endif
                                @endfor
                            @else
                                @if( $currentPage <= 2 )
                                    @for($i=1;$i<=5;$i++)
                                        @if( $currentPage==$i )
                                            <li class="active"><a href="/story?page={{ $i }}">{{ $i }}</a></li>
                                        @else
                                            <li><a href="/story?page={{ $i }}">{{ $i }}</a></li>
                                        @endif
                                    @endfor
                                @else

                                    @for($i = $currentPage-2;$i <= (($page_num>$currentPage+2)?($currentPage+2):$page_num);$i++)
                                        @if( $currentPage==$i )
                                            <li class="active"><a href="/story?page={{ $i }}">{{ $i }}</a></li>
                                        @else
                                            <li><a href="/story?page={{ $i }}">{{ $i }}</a></li>
                                        @endif
                                    @endfor
                                @endif
                            @endif

                        @if( $currentPage==$page_num )
                            <li class="disabled">
                                <a aria-label="Next">
                                    <span aria-hidden="true">下一页</span>
                                </a>
                            </li>
                        @else
                            <li>
                                <a href="/story?page={{ $currentPage+1 }}" aria-label="Next">
                                    <span aria-hidden="true">下一页</span>
                                </a>
                            </li>
                        @endif
                    </ul>
                </nav>
            </div>
        </div>
    </div>
@endsection

@section('script')
    <script>

    </script>
@endsection
